// 登录渲染
(async function () {
  const { data: { data } } = await axios.get('/index/getConfig')
  console.log(data)
  $('body').css('backgroundImage', `url(http://124.223.14.236:8060/${data.login_bg})`)
  $('.message').html(data.login_title)
  $('form').on('submit', async function (e) {
    e.preventDefault()
    const login_name = $('[name=username]').val()
    const password = $('[name=password]').val()
    let data = {
      login_name,
      password
    }
    const res = await axios.post('/index/login', data)
    localStorage.setItem('token', res.data.data.token)
    location.href = '/index.html'
  })
})()
